<?php
/**
 * JE Career package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2012 - 2013 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

defined('_JEXEC') or die('Restricted access');

$doc 				= & JFactory::getDocument();
$js  				= JURI::base().'components/com_hostingrajacareer/assets/js/validate_openings.js';
$doc->addScript($js);
$cs  				= JURI::base().'components/com_hostingrajacareer/assets/css/style.css';
$doc->addStyleSheet($cs);

// Get session
$session 			= & JFactory::getSession();
$ses 				= $session->get('formvalues');
$ses_error 			= $session->get('error');
if ( isset( $ses ) ) {
	$position 		= $ses['position'];
	$fullname 		= $ses['fullname'];
	$email 			= $ses['email'];
//	$mobile			= $ses['mobile'];
	$co_id 			= $ses['co_id'];
	$discription 	= $ses['discription'];
	} else {
	$position 		= '';
	$fullname 		= '';
	$email 			= '';
	//	$mobile 		= '';
	$text_resume 	= '';
	$co_id 			= '';
	}
?>
<div id="je_career_main_outer">
	<table border="0" id="products" cellpadding="0" cellspacing="0" width="100%">
		<tr>
			<td id="top-left"></td>
			<td id="top-center"></td>
			<td id="top-right"></td>
		</tr>
		<tr>
			<td id="middle-left"></td>
			<td>
				<?php if((isset($this->row->catid)==false) && $co_id==''){ ?>
					<div><?php echo JText::_( 'JE_NO_OPENINGS' ); ?></div>
				<?php }else{ ?>
				<div id="career_def_description">
					<p>
						<?php if(isset($this->row->discription)) {echo $this->row->discription;}?><?php if(!$this->row->discription) {if(isset($discription)){echo $discription;}}?>
					</p>
				</div>
				<form action="index.php?option=com_hostingrajacareer&view=career&task=save" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">

					<table class="admintable_c">
						<thead>
							<tr>
								<th class="key" colspan="2" id="tr_first_c_o">
									<?php echo strtoupper($this->row->position);?><?php if(!$this->row->position) {echo strtoupper($position);}?>
								</th>
							</tr>
						</thead>
						<tbody>
						<tr>
							<td colspan="2">
								<span id="je-required">* <?php echo JText::_( 'JE_REQUIRED' ); ?></span>
							</td>
						</tr>
						<tr>
							<td align="right" class="key" width="20%">
								<label for="name" id="fullname_l-error">
									<?php echo JText::_( 'JE_FULL_NAME' ); ?>:<span id="je-required">*</span>
								</label>
							</td>
							<td width="80%">
								<input class="required text_area text_area_current_o"   type="text" name="fullname" id="fullname" size="40" maxlength="256" value="<?php echo $fullname;?>"  onblur="clearLabel(this.id)"  />
								<span id="fullname-error"></span>
							</td>
						</tr>
							<td  align="right" class="key">
								<label for="name" id="email_c_o_l-error">
									<?php echo JText::_( 'JE_EMAIL' ); ?>:<span id="je-required">*</span>
								</label>
							</td>
							<td>
								<input class="required text_area  text_area_current_o"  type="text" name="email" id="email_c_o" size="40" maxlength="256" value="<?php echo $email;?>"  onblur="clearLabel(this.id)"  />
								<span id="email_c_o-error"></span>
							</td>
						<tr>
						</tr>
						<tr id="id_valid_c_o" style="display:none">
							<td align="center" >
							</td>
						</tr>
						
						<tr>
							<td align="right" class="key">
								<span id="resume_l-error">
									<?php echo JText::_( 'JE_UPLOAD_RESUME' ); ?>:
								</span>
								<span id="je-required">*</span>
							</td>
							<td>
								
								<input type="radio" name="radio" value="1" onclick="display(this.value)" checked><?php echo JText::_( 'JE_UPLOAD_LABEL' ); ?>
								
								<span id="resume-error"></span><span id="error" style="color:#FF0000;"><?php if($ses_error=='Captcha doesn\'t match'){}else{echo $ses_error; $session->clear('error');}?></span>
							</td>
						</tr>
						<tr id="tr_resume">
							<td></td>
							<td id="upfile" >
								<input type="file" name="resume"  id="resume" class="resume" size="27" value="" onblur="clearLabel(this.id)" style="display:block;">
								<span id="resume_span" style="display:block;"><?php echo JText::_( 'JE_IMAGE_DEFAULT_SIZE_FORMAT' ); if($this->settings->file_format!=''){echo " ".$this->settings->file_format;}else{echo " doc,pdf,txt,pptx";} ?></span>
								<textarea name="text_resume" rows="2" style="display:none; width:262px; height:60px;"  cols="20" id="text_resume" class="text_resume text_area_current_o_ta" onblur="clickpaste1()" onfocus="clickpaste()" ><?php echo JText::_( 'JE_CAREER_PASTE_HERE' ); ?></textarea>
							</td>
						</tr>
						<?php if ($this->settings->show_captcha == '1'){?>
						<tr class="table_tr_captcha">
							<td align="right" class="table_td_captcha">
								<label for="autarticaptcha_entry" id="label_captcha" style="text-align:right;color:#666666" class="key">
									<span id="autarticaptcha_entry_l-error"><?php echo JText::_( 'JE_CAPTCHA' ); ?> :</span><span id="je-required">*</span>
								</label>
							</td>
							<td id="table_td_captcha">
								<table>
									<tr>
										<td>
											<?php echo(AutarticaptchaHelper::generateHiddenTags());?>
											<?php echo(AutarticaptchaHelper::generateInputTags());?>
										</td>
										<td>
											<input type="hidden" name="capcha_y_n" id="capcha_y_n" value="yes" />
											<?php echo(AutarticaptchaHelper::generateImgTags("components/com_hostingrajacareer/captcha/"));?>
											<span id="autarticaptcha_entry-error"><span id="error" style="color:#FF0000;"><?php if($ses_error=='Captcha doesn\'t match'){echo $ses_error; $session->clear('error');}?></span></span>
										</td>
									</tr>
								</table>
							</td>
						</tr>
							<?php }else{	?>
							<input type="hidden" name="capcha_y_n" id="capcha_y_n" value="no" />
							<?php }?>
						<tr class="last_c_o_tr">
							<td align="right" colspan="4" >
								<input type="submit" class="sub_c_o" name="done"  id="done"   size="40" value="Carica" onClick="return submitbutton('save')"/>
							</td>
						</tr>
					</tbody>
				</table>
				<input type="hidden" name="discription" value="<?php echo $this->row->discription; ?><?php if(!$this->row->discription) {echo $discription;}?>" />
				<input type="hidden" name="position" value="<?php echo $this->row->position; ?><?php if(!$this->row->position) {echo $position;}?>" />
				<input type="hidden" name="option" value="com_hostingrajacareer" />
				<input type="hidden" name="co_id" value="<?php echo $this->row->catid; ?><?php if(!$this->row->catid) {echo $co_id;}?>" />
				<input type="hidden" name="controller" value="career" />
				<input type="hidden" name="task" value="save" />
				<?php echo JHTML::_( 'form.token' ); ?>
				</form>
				<?php } ?>
			</td>
			<td id="middle-right"></td>
		</tr>
		<tr>
			<td id="bottom-left"></td>
			<td id="bottom-center"></td>
			<td id="bottom-right"></td>
		</tr>
	</table>
</div>
